#include "Person.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void * Person_Create()
{
	Person * p = (Person *)malloc(sizeof(Person));
	if (p == NULL)
	{
		return NULL;
	}
	memset(p, 0, sizeof(Person));
	return p;
}

int Person_Destroy(void ** obj)
{
	if (obj == NULL)
	{
		return -1;
	}
	if (*obj == NULL)
	{
		return -1;
	}
	else
	{
		free(*obj);
		*obj = NULL;
		return 0;
	}
}

int Person_SetAge(void * obj, int value)
{
	if (obj == NULL)
	{
		return -1;
	}
	Person * pobj = (Person *)obj;
	pobj->m_Age = value;
	return 0;
}

int Person_GetAge(void * obj)
{
	if (obj == NULL)
	{
		return -1;
	}
	Person * pobj = (Person *)obj;
	return pobj->m_Age;
}

int Person_SetHeight(void * obj, int value)
{
	if (obj == NULL)
	{
		return -1;
	}
	Person * pobj = (Person *)obj;
	pobj->m_Height = value;
	return 0;
}

int Person_GetHeight(void * obj)
{
	if (obj == NULL)
	{
		return -1;
	}
	Person * pobj = (Person *)obj;
	return pobj->m_Height;
}

int Person_Size()
{
	return sizeof(Person);
}
